{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 创建交易对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<xtquant.xttrader.XtQuantTrader at 0x203ec0ee140>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import random\n",
    "from xtquant.xttrader import XtQuantTrader\n",
    "\n",
    "# miniQMT安装路径\n",
    "mini_qmt_path = r'D:\\国金证券QMT交易端\\userdata_mini'\n",
    "# 创建session_id\n",
    "session_id = int(random.randint(100000, 999999))\n",
    "# 创建交易对象\n",
    "xt_trader = XtQuantTrader(mini_qmt_path, session_id)\n",
    "\n",
    "xt_trader"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 查看xt_trader中的方法列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'async_client', 'callback', 'cancel_order_stock', 'cancel_order_stock_async', 'cancel_order_stock_sysid', 'cancel_order_stock_sysid_async', 'cbs', 'common_op_async_with_seq', 'common_op_sync_with_seq', 'connect', 'connected', 'executor', 'fund_transfer', 'handled_async_cancel_order_stock_order_id', 'handled_async_cancel_order_stock_order_sys_id', 'handled_async_order_stock_order_id', 'loop', 'oldloop', 'order_stock', 'order_stock_async', 'query_account_info', 'query_account_infos', 'query_account_infos_async', 'query_account_status', 'query_account_status_async', 'query_com_fund', 'query_com_position', 'query_credit_assure', 'query_credit_assure_async', 'query_credit_detail', 'query_credit_detail_async', 'query_credit_slo_code', 'query_credit_slo_code_async', 'query_credit_subjects', 'query_credit_subjects_async', 'query_ipo_data', 'query_ipo_data_async', 'query_new_purchase_limit', 'query_new_purchase_limit_async', 'query_stk_compacts', 'query_stk_compacts_async', 'query_stock_asset', 'query_stock_asset_async', 'query_stock_order', 'query_stock_orders', 'query_stock_orders_async', 'query_stock_position', 'query_stock_positions', 'query_stock_positions_async', 'query_stock_trades', 'query_stock_trades_async', 'queuing_cancel_errors_by_order_id', 'queuing_cancel_errors_by_order_sys_id', 'queuing_order_errors_byid', 'queuing_order_errors_byseq', 'queuing_order_seq', 'register_callback', 'relaxed_resp_executor', 'relaxed_resp_order_enabled', 'resp_executor', 'run_forever', 'secu_transfer', 'set_relaxed_response_order_enabled', 'set_timeout', 'sleep', 'smt_appointment_cancel_async', 'smt_appointment_order_async', 'smt_compact_renewal_async', 'smt_compact_return_async', 'smt_negotiate_order_async', 'smt_query_compact', 'smt_query_order', 'smt_query_quoter', 'start', 'stop', 'subscribe', 'unsubscribe']\n"
     ]
    }
   ],
   "source": [
    "print(dir(xt_trader))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "miniqmt-demo-cptEsqYo-py3.10",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
